#include <stdio.h>
#include <stdlib.h>

float grab(float* pf, int row, int col);

int main(void)
{
    float arr[3][3] = { {41.87, 436.3, 33.0},
                        {57.2, 41.9, 126.98},
                        {15.1, 66.7, 13.37}};
    float* pf = arr[0];
    
    int i; int j; int row; int col;
  
    for (i = 0; i < 3; i++)
     {
      for (j = 0; j < 3; j++)
        printf("%f\t", arr[i][j]);
      printf("\n");
      }  
	 //hint
     printf("\nThe Hint\n");
     for (row = 0; row < 9; row++)
     {
        printf("%f\t", *(pf + row));
        if ( (row +1) % 3 == 0) printf("\n");
	 }
   
   //Input index of desired element
      printf("\nEnter a row number between 1 and 3\n");
      scanf("%d", &row);
      printf("Enter a column number between 1 and 3\n");
      scanf("%d", &col);
      
      if (row > 0 && row < 4 && col > 0 && col < 4)
         printf("The (%d,%d) array element is %f\n",row, col, grab(pf, row-1, col-1));
      else
         printf("Out of Bounds");
         
         system("pause");
      return 0;
 }
/*=============================================*/
 float grab(float* pf, int row, int col)
{
	float num;
	int index;
	index = row * 3 + col;
	num = *(pf + index);
	    
	return num;
}